package com.xiaoyushu.user.relation.biz.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 执行 Lua 脚本返回结果
 *
 */
@Getter
@AllArgsConstructor
public enum LuaResuktEnum {
    //ZSET 不存在
    ZSET_NOT_EXIST(-1L),
    //关注已达上限
    FOLLOW_LIMIT(-2L),
    //已经关注了该用户
    ALREADY_FOLLOWED(-3L),
    //关注成功
    FOLLOW_SUCCESS(0L),

    //未关注该用户
    NOT_FOLLOWED(-4L),
    ;
    private final Long code;

    public static LuaResuktEnum valueOf(Long code){
        for (LuaResuktEnum luaResuktEnum:LuaResuktEnum.values()){
            if (Objects.equals(code,luaResuktEnum.getCode())){
                return luaResuktEnum;
            }
        }
        return null;
    }


}
